package com.amazon.controller;

import com.alibaba.fastjson.JSONObject;
import com.amazon.domain.Visiter;
import com.amazon.resp.RespEntity;
import com.amazon.service.VisiterService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/visiter")
public class VisiterController {

    @Resource
    private VisiterService visiterService;

    @PostMapping("add")
    public RespEntity addVisiter(@RequestBody Visiter param, HttpServletRequest request){
        visiterService.addVisiter(param,request);
        return RespEntity.success();
    }

    @GetMapping("count-info")
    public RespEntity countInfo(){
        JSONObject res = visiterService.countInfo();
        return RespEntity.success(res);
    }


}
